// https://eslint.org/docs/latest/use/configure/configuration-files-deprecated
// https://eslint.org/docs/latest/use/configure/configuration-files
// https://antfu.me/posts/why-not-prettier-zh
// https://eslint.org/docs/latest/use/configure/language-options
// https://eslint.org/blog/2023/10/deprecating-formatting-rules/

import globals from 'globals'
import jseslint from '@eslint/js'
import tseslint from 'typescript-eslint'
import stylistic from '@stylistic/eslint-plugin'
import pluginVue from 'eslint-plugin-vue'

export default tseslint.config(
  {
    ignores: ['**/node_modules', '**/dist'],
  },
  {
    files: ['**/*.{js,mjs,ts,cjs,vue}'],
  },
  {
    languageOptions: {
      globals: {
        ...globals.browser,
        uni: 'readonly',
        plus: 'readonly',
        wx: 'readonly',
      },
    },
  },
  // https://eslint.org/docs/latest/rules/
  jseslint.configs.recommended,
  // https://typescript-eslint.io/getting-started
  ...tseslint.configs.recommended,
  // https://eslint.style/rules
  stylistic.configs['recommended-flat'],
  stylistic.configs.customize({
    'indent': 2,
    'quotes': 'single',
    'semi': false,
    'no-extra-semi': true,
  }),
  ...pluginVue.configs['flat/recommended'],
  {
    rules: {
      'vue/multi-word-component-names': 'off',
    },
  },
)
